package ink.charon.novel.core.processor;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;
import us.codecraft.webmagic.selector.Selectable;

import java.util.List;

public class CatProcessor implements PageProcessor {
    @Override
    public void process(Page page) {
        List<Selectable> catNodes = page.getHtml().xpath("/html/body/div[2]/div[5]/div/div[2]/div[1]/div[2]/a").nodes();
        catNodes.remove(0);
        for (Selectable catNode : catNodes) {
            System.out.println(catNode.xpath("a/text()").get());
        }
    }

    @Override
    public Site getSite() {
        return Site.me();
    }
}
